package com.itheima.request;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@WebServlet("/haonan")
public class HaoNanServlet extends HttpServlet {
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

    }

    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        System.out.println("查看浩南接受的请求和响应地址"+request+" "+response.hashCode());
           //  山鸡说 它把它的积蓄给过来了 我只要凑够一百就可以了
        // 山鸡的钱取出来  因为在同一次请求中 所以可以从请求域中获取
        Object money = request.getAttribute("money");
        System.out.println("山鸡传过来的钱是:"+money);
        //浩南要进行处理
        System.out.println("浩南说，我婚都不结 都给给你还钱！");

        response.setContentType("text/html;charset=utf-8");

        response.getWriter().write("把100块还给了 乌鸦");
    }
}
